package com.example.eos.service;

import com.example.eos.bean.ReturnInfo;
import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import java.util.UUID;

@Service
public class GlobalService {

    //返回错误信息
    public ReturnInfo returnErrors(BindingResult result, List<String> stringList){
        List<ObjectError> objectErrors = result.getAllErrors();
        for(ObjectError objectError : objectErrors){
            stringList.add(objectError.getDefaultMessage());
        }
        return ReturnInfo.info2("失败", stringList);
    }

}
